from typing import List

from llvmlite import ir


def get_block_jump_targets(block: ir.Block) -> List[ir.Block]:
    """
    获取基础块要跳转到的目标。
    :param block:
    :return:
    """
    instr = block.instructions[-1]
    if isinstance(instr, ir.Ret):
        return []
    elif isinstance(instr, (ir.ConditionalBranch,)):
        return instr.operands[1:]
    elif isinstance(instr, ir.Branch):
        return instr.operands
    else:
        raise NotImplementedError(instr)
